
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.*;


public class TelnetFenetre extends JFrame{
	private JPanel jpn;
	ImageIcon icon2;
	
	TelnetFenetre(String Ip,int port){
		Image icone = Toolkit.getDefaultToolkit().getImage("telnet.jpg");
		this.setIconImage(icone);
		JPanel jpnall = new JPanel();
		/*{
			
			protected void paintComponent(Graphics g)
			{
				icon2 = new ImageIcon("Wallpaper_Misc01.jpg");
				Dimension tailleEcran = java.awt.Toolkit.getDefaultToolkit().getScreenSize();				
				int hauteur = (int)tailleEcran.getHeight();
				int largeur = (int)tailleEcran.getWidth();
				g.drawImage(icon2.getImage(),0,0, largeur,hauteur,  null);
 
				super.paintComponent(g);
			}
		};
		*/
		jpnall.setOpaque( false );
		jpnall.setPreferredSize( new Dimension(400, 400) );
		jpnall.setLayout(new BorderLayout());
			try {
				
				String host = Ip;
				Component t = new BasicTelnet(host, port);
				setLayout(new BorderLayout());
				jpnall.add(t, BorderLayout.WEST);
				getContentPane().add(jpnall, BorderLayout.CENTER);
				setLocationRelativeTo(this.getParent());
				pack();
				show();
				addWindowListener(new WindowAdapter() {
					public void windowClosing(WindowEvent e)
					{
						Window f = e.getWindow();
						f.dispose();
						}
					});
				} catch (Exception e) {// e.printStackTrace();				
				}	
				setTitle("Telnet "+Ip);
				this.setLocation(150,150);
				this.setResizable(false);
				this.setSize(785,570);		
	}	
}
